<template>
  <div
    :class="{ line: row === 1, lines: row > 1 }"
    :title="hoverTip ? content : null"
    :style="{ '--row': row }"
  >
    <slot name="pre"></slot>
    {{ content }}
    <slot name="aft"></slot>
  </div>
</template>

<script>
export default {
    name: 'Ellipsis',
    props: {
        row: {
            type: Number,
            default: 1,
        },
        hoverTip: {
            type: Boolean,
            default: false,
        },
        content: {
            type: String,
            default: '',
        },
    },
}
</script>

<style lang="scss" scoped>
.line {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  :deep(.el-icon){
    margin-right: 5px;
    position: relative;
    top: 2px;
  }
}
.lines {
  display: -webkit-box;
  word-break: break-all;
  overflow: hidden;
  text-overflow: ellipsis;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
}
</style>